class Solution {
public:
    int numRabbits(vector<int>& answers) {

        int ret=0;
        int f[1100]={0};
        for(int i=0;i<answers.size();i++)
        {
            if(f[answers[i]]==0)
            {
                ret+=answers[i]+1;
                f[answers[i]]=answers[i];
            }
            else{
                f[answers[i]]--;
            }
        }
        return ret;
    }
};
